package sw.model;

import lombok.Data;
import sw.entity.Result;

@Data
public class MResult {
	private Integer assetId;//资产Id
	private String assetName;//资产名称
	private Float importance;//资产重要性指标
	private String weakName;//威胁描述
	private Float severity;//脆弱性严重程度
	private Float frequency;//发生频率
	private Float riskValue;//风险值
	private String isAccept;//是否为可接受
	private  String riskLevel;//风险等级
	
	public MResult(Result re) {
		this.assetId = re.getWeekness().getThread().getAsset().getId();
		this.assetName = re.getWeekness().getThread().getAsset().getName();
		this.importance = re.getWeekness().getThread().getAsset().getImportance();
		this.weakName = re.getWeekness().getName();
		this.severity = re.getWeekness().getSeverity();
		this.frequency = re.getWeekness().getThread().getFrequency();
		this.riskValue = re.getRiskValue();
		if(re.getIsAccept()==0){
			this.isAccept = "否";
		}
		if(re.getIsAccept()==1){
			this.isAccept = "是";
		}
		this.riskLevel = re.getRiskLevel().getName();
	}
	public MResult(Integer id ,Result re) {
		this.assetId = id;
		this.assetName = re.getWeekness().getThread().getAsset().getName();
		this.importance = re.getWeekness().getThread().getAsset().getImportance();
		this.weakName = re.getWeekness().getName();
		this.severity = re.getWeekness().getSeverity();
		this.frequency = re.getWeekness().getThread().getFrequency();
		this.riskValue = re.getRiskValue();
		if(re.getIsAccept()==0){
			this.isAccept = "否";
		}
		if(re.getIsAccept()==1){
			this.isAccept = "是";
		}
		this.riskLevel = re.getRiskLevel().getName();
	}
	
	
	
}
